package com.example.commen.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

public class EventBusEntity implements Parcelable, Serializable {
    private int mMsgId;
    private String context;
    private int type;

    private Object object;

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public EventBusEntity(int msgid) {
        mMsgId = msgid;
    }

    public EventBusEntity() {
    }
    public EventBusEntity(Object object) {
        this.object = object;
    }


    public void setMsgId(int mMsgId) {
        this.mMsgId = mMsgId;
    }

    public void setContext(String id) {
        this.context = id;
    }

    public int getMsgId() {
        return mMsgId;
    }

    public String getContext() {
        return context;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.mMsgId);
        dest.writeString(this.context);
        dest.writeInt(this.type);
        dest.writeParcelable((Parcelable) this.object, flags);
    }

    public void readFromParcel(Parcel source) {
        this.mMsgId = source.readInt();
        this.context = source.readString();
        this.type = source.readInt();
        this.object = source.readParcelable(Object.class.getClassLoader());
    }

    protected EventBusEntity(Parcel in) {
        this.mMsgId = in.readInt();
        this.context = in.readString();
        this.type = in.readInt();
        this.object = in.readParcelable(Object.class.getClassLoader());
    }

    public static final Creator<EventBusEntity> CREATOR = new Creator<EventBusEntity>() {
        @Override
        public EventBusEntity createFromParcel(Parcel source) {
            return new EventBusEntity(source);
        }

        @Override
        public EventBusEntity[] newArray(int size) {
            return new EventBusEntity[size];
        }
    };
}
